package com.example.demo.consumer;

import com.example.demo.entity.UserLogInfo;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

import java.util.concurrent.CompletableFuture;

@Component
public class MyConsumer {

    @KafkaListener(topics = "user-log-action",groupId = "springboot-consumer")
    public void onMessage(ConsumerRecord<String, UserLogInfo> record) {
        System.out.println("消费者收到的消息："
                + "主题是：" + record.topic() + "\t"
                + "分区：" + record.partition() + "\t"
                + "偏移量" + record.offset() + "\t"
                + "key: " + record.key() + "\t"
                + "value: " + record.value());
    }

}
